﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Windows.Threading;

namespace de.codingfreaks.libs.cfThreadingTools
{

    /// <summary>
    /// Delegate for methods which are able to set a property directly on a control.
    /// </summary>
    /// <param name="ctlTarget">The control which holds the property.</param>
    /// <param name="strPropertyName">The name of the property (case-sensitive!).</param>
    /// <param name="objValue">An object which includes the new value of the property.</param>
    internal delegate void SetPropertyValueDelegate(Control ctlTarget, 
                                                    string strPropertyValue, 
                                                    object objValue);

    /// <summary>
    /// Delegate for methods which are able to set a property directly on a WPF-based control.
    /// </summary>
    /// <param name="dobjTarget">The <see cref="DispatcherObject"/> to handle.</param>
    /// <param name="strPropertyName">The name of the property (case-sensitive!).</param>
    /// <param name="objValue">An object which includes the new value of the property.</param>
    internal delegate void SetWpfPropertyValueDelegate(DispatcherObject dobjTarget,
                                                       string strPropertyValue,
                                                       object objValue);

    /// <summary>
    /// Delegate for methods which are able to set a property on an object depending of the
    /// result of InvokeRequired of a control.
    /// </summary>
    /// <param name="ctlTarget">The control which should be checked for InvokeRequired.</param>
    /// <param name="objPropertyObject">The object which holds the property.</param>
    /// <param name="strPropertyName">The name of the property (case-sensitive!).</param>
    /// <param name="objValue">An object which includes the new value of the property.</param>
    internal delegate void SetSubPropertyValueDelegate(Control ctlTarget,
                                                       object objPropertyOwner,
                                                       string strPropertyValue,
                                                       object objValue);

    /// <summary>
    /// Delegate for methods which are able to set a property on an object depending of the
    /// result of Dispatcher of a WPF control.
    /// </summary>
    /// <param name="dobjTarget">The WPF control which should be checked.</param>
    /// <param name="objPropertyObject">The object which holds the property.</param>
    /// <param name="strPropertyName">The name of the property (case-sensitive!).</param>
    /// <param name="objValue">An object which includes the new value of the property.</param>
    internal delegate void SetWpfSubPropertyValueDelegate(DispatcherObject dobjTarget,
                                                          object objPropertyOwner,
                                                          string strPropertyValue,
                                                          object objValue);

    /// <summary>
    /// Delegate for methods which are able to invoke a method directly on a control.
    /// </summary>
    /// <param name="ctlTarget">The control which's method should be invoked.</param>
    /// <param name="strMethodName">The name of the method (case-sensitive!).</param>
    /// <param name="aobjParameters">The parameters to pass to the method.</param>
    /// <returns>The result of the method, if it has one.</rereturns>
    internal delegate object InvokeMethodDelegate(Control ctlTarget,
                                                  string strMethodName,
                                                  params object[] aobjParameters);

    /// <summary>
    /// Delegate for methods which are able to invoke a method directly on a WPF control.
    /// </summary>
    /// <param name="dobjTarget">The WPF control which's method should be invoked.</param>
    /// <param name="strMethodName">The name of the method (case-sensitive!).</param>
    /// <param name="aobjParameters">The parameters to pass to the method.</param>
    /// <returns>The result of the method, if it has one.</rereturns>
    internal delegate object InvokeWpfMethodDelegate(DispatcherObject dobjTarget,
                                                     string strMethodName,
                                                     params object[] aobjParameters);

    /// <summary>
    /// Delegate for methods which are able to invoke a method on an object depending of the
    /// result of InvokeRequired of a control.
    /// </summary>
    /// <param name="ctlTarget">The control which should be checked for InvokeRequired.</param>
    /// <param name="objPropertyObject">The object which's method should be invoked.</param>
    /// <param name="strMethodName">The name of the method (case-sensitive!).</param>
    /// <param name="aobjParameters">The parameters to pass to the method.</param>
    /// <returns>The result of the method, if it has one.</rereturns>
    internal delegate object InvokeSubMethodDelegate(Control ctlTarget,
                                                     object objPropertyObject,
                                                     string strMethodName,
                                                     params object[] aobjParameters);

    /// <summary>
    /// Delegate for methods which are able to invoke a method on an object depending of the
    /// result of CheckAccess of a WPF control.
    /// </summary>
    /// <param name="dobjTarget">The WPF control which should be checked.</param>
    /// <param name="objPropertyObject">The object which's method should be invoked.</param>
    /// <param name="strMethodName">The name of the method (case-sensitive!).</param>
    /// <param name="aobjParameters">The parameters to pass to the method.</param>
    /// <returns>The result of the method, if it has one.</rereturns>
    internal delegate object InvokeWpfSubMethodDelegate(DispatcherObject dobjTarget,
                                                        object objPropertyObject,
                                                        string strMethodName,
                                                        params object[] aobjParameters);

}
